import { ref } from 'vue';
import AggModelAdd from './components/AggModelAdd/index.vue';
import AggModelList from './components/AggModelList/index.vue';

export default defineComponent({
  setup(props, context) {
    const handleEdit = (aggModel: any) => {
      // showAdd.value = true;
      aggModelAddRef.value && aggModelAddRef.value.initData(aggModel);
    };
    const handleClosed = () => {
      // showAdd.value = false;
      aggModelListRef.value && aggModelListRef.value.tableRequest();
    };
    // const showAdd = ref(false);
    const aggModelListRef = ref();
    const aggModelAddRef = ref();
    context.expose({ handleEdit });
    return () => {
      return (
        <div>
          <AggModelList onEdit={handleEdit} ref={aggModelListRef} />
          <AggModelAdd ref={aggModelAddRef} onClosed={handleClosed} />
        </div>
      );
    };
  }
});
